package org.maps;

import java.util.Iterator;

/**
 * Created by oler on 20.08.14.
 */
public interface MyMap {

    public interface MyMapEntry {

        /**
         * сompares the specified object with this entry for equality
         *
         * @param o
         * @return
         */
        @Override
        boolean equals(Object o);

        /**
         * returns the key corresponding to this entry
         *
         * @return
         */
        Object getKey();

        /**
         * returns the value corresponding to this entry
         *
         * @return
         */
        Object getValue();

        /**
         * returns the hash code value for this map entry
         *
         * @return
         */
        @Override
        int hashCode();

        /**
         * replaces the value corresponding to this entry
         * with the specified value
         *
         * @param value
         * @return
         */
        Object setValue(Object value);


    }

    /**
     * removes all of the mappings from this map
     */
    void clear();

    /**
     * returns true if this map contains a mapping
     * for the specified key
     *
     * @return
     */
    boolean containsKey(Object key);

    /**
     * returns true if this map maps one or more keys
     * to the specified value
     *
     * @param value
     * @return
     */
    boolean containsValue(Object value);

    /**
     * returns the value to which the specified key is mapped,
     * or null if this map contains no mapping for the key
     *
     * @return
     */
    Object get(Object key);

    /**
     * returns true if this map contains no key-value mappings
     *
     * @return
     */
    boolean isEmpty();

    /**
     * associates the specified value with the specified
     * key in this map
     *
     * @return
     */
    Object put(Object key, Object value);

    /**
     * removes the mapping for the specified key from this map if present
     *
     * @param key
     * @return
     */
    Object remove(Object key);

    /**
     * returns the number of key-value mappings in this map
     *
     * @return
     */
    int size();

    /**
     * returns an iterator over the elements (MyMap.Entry)
     * in proper sequence
     *
     * @return
     */
    Iterator entryIterator();

}
